package com.aaa.mrcai.service.impl;

import com.aaa.mrcai.mapper.GoStoreMapper;
import com.aaa.mrcai.pojo.entity.BussinessInfo;
import com.aaa.mrcai.pojo.entity.StoreGoods;
import com.aaa.mrcai.result.AjaxResult;
import com.aaa.mrcai.service.GoStoreService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * TODO
 *
 * @author 惠普
 * @date 2021/12/20  9:25
 */

@Service
public class GoStoreServiceImpl implements GoStoreService {

    @Autowired
    private GoStoreMapper goStoreMapper;

    @Override
    public AjaxResult storeGoods(int id) {
        Map<String, Object> map = new HashMap<>();
        List<StoreGoods> storeGoods = goStoreMapper.goStore(id);
        BussinessInfo businessInfo = goStoreMapper.getBusinessInfo(id);
        map.put("storeGoods",storeGoods);
        map.put("businessInfo",businessInfo);
        if(map.size()>0){
            return AjaxResult.success(map);
        }else {
            return AjaxResult.defeated();
        }
    }
}
